package com.dss.code_generation.service.impl;

import com.dss.code_generation.util.IpUtil;
import com.dss.code_generation.util.StringUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @author: dongshoushan
 */
@Order(value = 1)
@Slf4j
@Component
@RequiredArgsConstructor(onConstructor = @_(@Autowired))
public class InitRun implements CommandLineRunner {
    @Value("${server.port}")
    private  String port;
    @Override
    public void run(String... args) throws Exception {
        String localIp = IpUtil.getLocalIp();
        System.out.println("代码生成工具启动成功");
        System.out.println(StringUtils.format("首页 http://{}:{}/page/index.html",localIp,port));
        System.out.println(StringUtils.format("swagger http://{}:{}/doc.html",localIp,port));
        //        Runtime.getRuntime().exec(StringUtils.format("cmd   /c   start  http://{}:8088/page/index.html",localIp));
    }
}
